<?php
namespace plugins\message_push\model;

use app\zyapi\lib\zy_message\aliyunsms\SmsSend;

/**
 * 短信模板发送
 */
class AliyunSMS
{

    public function send_sms($param)
    {
        //根据公司id和templateCode查询
        $sms_config = db('sms_config')->where('company_id',$param['company_id'])->where('temp_code',$param['temp_code'])->find();
        if(empty($sms_config)){
            return api_json_echo(false,'请先配置短信信息');
        }
        $smsSend = new SmsSend($sms_config['key'],$sms_config['secret'],$sms_config['temp_autograph']);
        $response = $smsSend::sendSms($param['phone'],$param['temp_code'],$param['content']);
        $res = json_encode($response);
        return json_decode($res,true);
    }


}